<?php

namespace App;


use Encore\Admin\Grid;
use Encore\Admin\Facades\Admin;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Grip extends Authenticatable
{
    use Notifiable;

    public $table = "grips";

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'grip_number', 'grip_name',
    ];


    public function chest()
    {
        return $this->belongsTo(Chest::class, 'chest_id');
    }

    public function type()
    {
        return $this->belongsTo(GripType::class, 'type_id');
    }


    public function getNumber()
    {
        return $this->grip_number;
    }
    public function getId()
    {
        return $this->id;
    }

    public function group()
    {
        return $this->belongsTo(Group::class,'device_id');
    }
    public function getHumanStatusAttribute()
    {
        $statusArr = [
            0 => '空',
            1 => '满'
        ];
        return array_get($statusArr, $this->status);
    }

}